# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=nirsoft
pkgver=1.23.30
pkgrel=1
pkgdesc='Unique collection of small and useful freeware utilities.'
groups=('blackarch' 'blackarch-windows' )
arch=('any')
makedepends=('unzip' 'curl')
url='https://www.nirsoft.net'
urlZip="https://download.nirsoft.net/nirsoft_package_enc_$pkgver.zip"

pkgver() {
	curl "https://launcher.nirsoft.net/downloads/index.html" 2>/dev/null |
    grep -P '<a.*_enc_.*\.zip' | sed -r 's/.*_([0-9]+\.[0-9]+\.[0-9]+).*/\1/gi'
}
package() {
	tmpFile='/tmp/nirsoft.zip'
	targetDir="$pkgdir/usr/share/windows/nirsoft/"

  install -dm 755 "${targetDir}"

  curl -H "Referer: ${url}" --output "${tmpFile}" "${urlZip}"

  unzip -d "${targetDir}" -P 'nirsoft9876$' "${tmpFile}"

  rm -rf "${tmpFile}"
}

